package com.yy.wga.goods.service.api.response;

import com.alibaba.fastjson.annotation.JSONField;
import com.yy.wga.common.util.common.StringUtils;
import lombok.Data;

import java.util.Objects;

@Data
public class BaseApiDTO {

    @JSONField(name = "errcode")
    private Integer errcode;

    @JSONField(name = "errmsg")
    private String errmsg;

    public boolean isSuccsss() {
        return Objects.equals(errcode, 0);
    }

    public String getRid() {
        if (StringUtils.isNotBlank(errmsg)) {
            return errmsg.replace(" rid: ", "");
        }
        return "";
    }
}
